<?php

	class cct_cart extends ctl_cart
	{
		function shipping()
		{
			$sale = $this->system->loadModel('trading/sale');
			$trading = $sale->getCartObject($this->cart,$GLOBALS['runtime']['member_lv'],true);

			$shipping = $this->system->loadModel('trading/delivery');
			$aShippings = $shipping->getDlTypeByArea($_POST['area']);
			//error_log(print_r($aShippings,true),3,__FILE__.'.aShippings.log');	//alone
			foreach($aShippings as $k=>$s){
				$aShippings[$k]['price'] = cal_fee($s['expressions'],$trading['weight'],$trading['pmt_b']['totalPrice'],$s['price']);
				if($s['pad'] == 0 || $s['has_cod'] == 0) $aShippings[$k]['has_cod'] = 0;
				if($s['protect']==1){
					$aShippings[$k]['protect'] = max($trading['totalPrice']*$s['protect_rate'],$s['minprice']);
				}else{
					$aShippings[$k]['protect'] = false;
				}
				/* alone start 2009年10月21号 13:58:29 */
				if ($trading['weight'] >= $aShippings[$k]['maxWeight'])
				{
					unset($aShippings[$k]);
				}
				/* alone end 2009年10月21号 14:03:51 */
			}

			$this->pagedata['shippings'] = $aShippings;
			$this->__tmpl='cart/checkout_shipping.html';
			$this->output();
		}
	}
?>